package com.itheima.server.service;

import com.itheima.dubbo.api.UserApi;
import com.itheima.model.domain.User;
import com.itheima.model.vo.HuanXinUserVo;
import com.itheima.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class HuanxinService {
    @DubboReference
    private UserApi userApi;
    public HuanXinUserVo findHuanxinUser() {
       User user= userApi.findById(UserHolder.getUserId());
       if (user==null){
           return null;
       }
       return new HuanXinUserVo(user.getHxUser(),user.getHxPassword());
    }
}
